# -*- coding: utf-8 -*-
# 导入无动画、无动作切换屏幕包
#:import NoTransition kivy.uix.screenmanager.NoTransition
#:import Clock kivy.clock.Clock

SpiderMainScreenManager:
    id: screen_manager
    # 设置无动作、无动画切换屏幕
    transition: NoTransition()
    # 视频选择(展示)区域窗口
    VideoSelectScreen:
        name: "select_video"
        manager: screen_manager

    AnimeInfoShow:
        name: "anime_info_show"
        manager: screen_manager

    # 播放视频窗口
    PlaySpiderVideo:
        name: "play_spider_video"
        manager: screen_manager

    # BiliBili视频区
    BiliBiliScreen:
        name: "bilibili_video"
        manager: screen_manager

    # 腾讯视频区
    TencentScreen:
        name: "tencent_video"
        manager: screen_manager

    # 优酷视频区
    YoukuScreen:
        name: "youku_video"
        manager: screen_manager


# BiliBili播放区
<BiliBiliScreen>:
    videoRecycleView: videoRecycleView.__self__
    BoxLayout:
        FloatLayout:
            FloatLayout:
                # 控制子控件的最大尺寸
                size_hint: (1.0, 0.05)
                pos_hint: {"x":0.0, "top": 0.995}

                Button:
                    text: "BiliBili"
                    font_size: "22sp"
                    size_hint: (0.30, 1.0)
                    pos_hint: {"x":0.04, "top":1.0}
                    on_release:
                        app.root.add_all_links()

                Button:
                    text: "腾讯视频"
                    font_size: "22sp"
                    size_hint:(0.30, 1.0)
                    pos_hint: {"x":0.35, "top":1.0}
                    on_release:
                        app.root.tencent_screen()
                        app.root.tx_add_all_links()

                Button:
                    text: "优酷视频"
                    font_size: "22sp"
                    size_hint:(0.30, 1.0)
                    pos_hint: {"x":0.66, "top":1.0}
                    on_release:
                        app.root.youku_screen()
                        app.root.yk_add_all_links()

                # 全部动画按钮
                Button:
                    text: "全部动画"
                    font_size: "22sp"
                    size_hint: (0.30, 1.0)
                    pos_hint: {"x":0.04, "top":0.0}
                    on_release:
                        app.root.add_all_links()

                # 连载动画
                Button:
                    text: "连载动画"
                    font_size: "22sp"
                    size_hint:(0.30, 1.0)
                    pos_hint: {"x":0.35, "top":0.0}
                    on_release:
                        app.root.add_is_status_links('连载')

                # 完结动画
                Button:
                    text: "完结动画"
                    font_size: "22sp"
                    size_hint:(0.30, 1.0)
                    pos_hint: {"x":0.66, "top":0.0}
                    on_release:
                        app.root.add_is_status_links('完结')

            FloatLayout:
                pos_hint_x: None
                # 滚动视图用法
                RecycleView:
                    id: videoRecycleView
                    size_hint_y: None
                    size_hint_x: None
                    height: "600dp"
                    width: '600dp'
                    pos_hint: {"x":0.215, "top":0.80}
                    viewclass: 'SelectableVideoAsyncImage'
                    SelectableRecycleGridLayout:
                        cols: 2
                        size_hint: (1.0,None)
                        height: self.minimum_height
                        multiselect: False
                        touch_multiselect: False


<TencentScreen>:
    videoRecycleView: videoRecycleView.__self__
    BoxLayout:
        FloatLayout:
            FloatLayout:
                # 控制子控件的最大尺寸
                size_hint: (1.0, 0.05)
                pos_hint: {"x":0.0, "top": 0.995}
                Button:
                    text: "BiliBili"
                    font_size: "22sp"
                    size_hint: (0.30, 1.0)
                    pos_hint: {"x":0.04, "top":1.0}
                    on_release:
                        app.root.bilibili_screen()
                        app.root.add_all_links()

                Button:
                    text: "腾讯视频"
                    font_size: "22sp"
                    size_hint:(0.30, 1.0)
                    pos_hint: {"x":0.35, "top":1.0}
                    on_release:
                        app.root.tx_add_all_links()

                Button:
                    text: "优酷视频"
                    font_size: "22sp"
                    size_hint:(0.30, 1.0)
                    pos_hint: {"x":0.66, "top":1.0}
                    on_release:
                        app.root.youku_screen()
                        app.root.yk_add_all_links()

            FloatLayout:
                pos_hint_x: None
                # 滚动视图用法
                RecycleView:
                    id: videoRecycleView
                    size_hint_y: None
                    size_hint_x: None
                    height: "600dp"
                    width: '600dp'
                    pos_hint: {"x":0.215, "top":0.80}
                    viewclass: 'SelectableVideoAsyncImage'
                    SelectableRecycleGridLayout:
                        cols: 2
                        size_hint: (1.0,None)
                        height: self.minimum_height
                        multiselect: False
                        touch_multiselect: False


<YouKuScreen>:
    videoRecycleView: videoRecycleView.__self__
    BoxLayout:
        FloatLayout:
            FloatLayout:
                # 控制子控件的最大尺寸
                size_hint: (1.0, 0.05)
                pos_hint: {"x":0.0, "top": 0.995}
                Button:
                    text: "BiliBili"
                    font_size: "22sp"
                    size_hint: (0.30, 1.0)
                    pos_hint: {"x":0.04, "top":1.0}
                    on_release:
                        app.root.bilibili_screen()
                        app.root.add_all_links()

                Button:
                    text: "腾讯视频"
                    font_size: "22sp"
                    size_hint:(0.30, 1.0)
                    pos_hint: {"x":0.35, "top":1.0}
                    on_release:
                        app.root.tencent_screen()
                        app.root.tx_add_all_links()

                Button:
                    text: "优酷视频"
                    font_size: "22sp"
                    size_hint:(0.30, 1.0)
                    pos_hint: {"x":0.66, "top":1.0}
                    on_release:
                        app.root.yk_add_all_links()

            FloatLayout:
                pos_hint_x: None
                # 滚动视图用法
                RecycleView:
                    id: videoRecycleView
                    size_hint_y: None
                    size_hint_x: None
                    height: "600dp"
                    width: '600dp'
                    pos_hint: {"x":0.215, "top":0.80}
                    viewclass: 'SelectableVideoAsyncImage'
                    SelectableRecycleGridLayout:
                        cols: 2
                        size_hint: (1.0,None)
                        height: self.minimum_height
                        multiselect: False
                        touch_multiselect: False

# 视频区布局
<VideoSelectScreen>:
    Image:
        source: "sources/background_img1.png"
    BoxLayout:
        FloatLayout:
            FloatLayout:
                # 控制子控件的最大尺寸
                size_hint: (1.0, 0.05)
                pos_hint: {"x":0.0, "top": 0.995}

                # BiliBili
                Button:
                    text: "BiliBili"
                    font_size: "22sp"
                    size_hint: (0.30, 1.0)
                    pos_hint: {"x":0.04, "top":1.0}
                    on_release:
                        app.root.bilibili_screen()
                        app.root.add_all_links()

                # 腾讯视频
                Button:
                    text: "腾讯视频"
                    font_size: "22sp"
                    size_hint:(0.30, 1.0)
                    pos_hint: {"x":0.35, "top":1.0}
                    on_release:
                        app.root.tencent_screen()
                        app.root.tx_add_all_links()

                # 优酷视频
                Button:
                    text: "优酷视频"
                    font_size: "22sp"
                    size_hint:(0.30, 1.0)
                    pos_hint: {"x":0.66, "top":1.0}
                    on_release:
                        app.root.youku_screen()
                        app.root.yk_add_all_links()




<AnimeInfoShow>:
    grid_button: grid_button.__self__
    img_show: img_show.__self__
    anime_name_show: anime_name_show.__self__
    BoxLayout:
        orientation: "vertical"
        size_hint: (1.0, 0.8)
        pos_hint: {"x": 0.0, "y": 0.2}
        canvas:
            Color:
                rgb: (0.3, 0.5, 0.7)
            Rectangle:
                size: (self.width, self.height)
                pos: (self.x, self.y)
        BoxLayout:
            # 这里可以放图片
            orientation: "horizontal"
            size_hint: (1.0, 1.0)
            pos_hint: {'x': 0.0, 'top': 0.02}
            AsyncImage:
                id: img_show
#                size_hint: (0.3, 1.0)
#                pos_hint: {'x': 0.02, 'top': 0.02}

            Label:
                id: anime_name_show
                font_size: '30sp'
#                size_hint: (0.6, 1.0)
#                pos_hint: {'x': 0.345, 'top': 0.12}

        GridLayout:
            id: grid_button
            cols: 8
            size_hint: (1.0, 0.6)

#    BoxLayout:
#        size_hint: (1.0, 0.2)
#        pos_hint: {"x": 0.0, "y": 0.0}
#        canvas:
#            Color:
#                rgb: (0.0, 0.0, 0.0)
#            Rectangle:
#                size: (self.width, self.height)
#                pos: (self.x, self.y)


<PlaySpiderVideo>:
    video_play: video_play.__self__
    FloatLayout:
        VideoPlayer:
            id: video_play
            size_hint: (0.8, 0.5)
            pos_hint: {"x": 0.1, "y": 0.485}
            allow_fullscreen: False

    FloatLayout:
        size_hint: (1.0, 0.4)
        pos_hint: {"x": 0.0, "y": 0.0}
        Label:
            text: "评论区"
            font_size: sp(30)
#    Button:
#        text: "下载视频"
#        size_hint: (0.15, 0.04)
#        font_size: sp(20)
#        pos_hint: {"x": 0.425, "y": 0.0}
